package com.twotiger.and.bean;

import java.io.Serializable;

import com.twotiger.and.util.DateUtil;
import com.twotiger.and.util.LogUtil;

/**
 * 投资转让可转让
 * @Description: TODO(这里描述这个类的作用) 
 * @Author gao
 * @Date 2015年8月17日 下午3:44:51
 */
public class DebtTransing extends Basebean implements Serializable {

    private String nid; //项目编号    nid String  是
    private String name; //项目名称    name    String(1,60)    是
    private int remainDays; //剩余天数    remainDays  Integer 是
    private double investAmount; //投资金额    investAmount    Double(20,2)    是

    private int yield; //年利率 yield   Integer 是
    private double completedVal; //已转金额    completedVal    Double(20,2)    是
    private double dealProceeds; //到手金额    dealProceeds    Double(20,2)    是
    private double assignRate; //打折率 assignRate  Double(20,2)    是
    private String systime; //系统时间    systime String(17)  是
    private String deadline; //截止时间    deadline    String(17)  是
    private int discountMark;
    private int assignMark; //转让标识  assignMark  Integer 是   转让标识：0-无1-有
    private String pType;
    

    
    public String getpType() {
        return pType;
    }

    public void setpType(String pType) {
        this.pType = pType;
    }

    public int getAssignMark() {
        return assignMark;
    }

    public void setAssignMark(int assignMark) {
        this.assignMark = assignMark;
    }

    public int getDiscountMark() {
        return discountMark;
    }

    public void setDiscountMark(int discountMark) {
        this.discountMark = discountMark;
    }

    public String getNid() {
        return nid;
    }

    public void setNid(String nid) {
        this.nid = nid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getRemainDays() {
        return remainDays;
    }

    public void setRemainDays(int remainDays) {
        this.remainDays = remainDays;
    }

    public double getInvestAmount() {
        return investAmount;
    }

    public void setInvestAmount(double investAmount) {
        this.investAmount = investAmount;
    }

    public int getYield() {
        return yield;
    }

    public void setYield(int yield) {
        this.yield = yield;
    }

    public double getCompletedVal() {
        return completedVal;
    }

    public void setCompletedVal(double completedVal) {
        this.completedVal = completedVal;
    }

    public double getDealProceeds() {
        return dealProceeds;
    }

    public void setDealProceeds(double dealProceeds) {
        this.dealProceeds = dealProceeds;
    }

    public double getAssignRate() {
        return assignRate;
    }

    public void setAssignRate(double assignRate) {
        this.assignRate = assignRate;
    }

    public String getSystime() {
        return systime;
    }

    public void setSystime(String systime) {
        this.systime = systime;
    }

    public String getDeadline() {
        return deadline;
    }

    public void setDeadline(String deadline) {
        this.deadline = deadline;
    }

    /**倒计时*/
    private String time2Start;
    private long localSysTime = System.currentTimeMillis();

    public String getTime2Start() {
        LogUtil.info(ProjectDetail.class, deadline + " " + systime);
        long t = DateUtil.subDate(
            (Long.parseLong(systime) + System.currentTimeMillis() - localSysTime) + "", deadline);
        if (t < 0) {
            time2Start = "已完成";
        } else {
            String[] tmps = secondToDate(t / 1000);
            time2Start = tmps[0] + "天" + tmps[1] + "小时" + tmps[2] + "分" + tmps[3]+"秒";
        }
        return time2Start;
    }

    public String[] secondToDate(long prt) {
        int dd = (int) (prt / 60 / 60 / 24); //计算剩余的天数
        int hh = (int) (prt / 60 / 60 % 24); //计算剩余的小时数
        int mm = (int) (prt / 60 % 60); //计算剩余的分钟数
        int ss = (int) (prt % 60); //计算剩余的秒数

        String dd1 = checkTime(dd);
        String hh1 = checkTime(hh);
        String mm1 = checkTime(mm);
        String ss1 = checkTime(ss);
        return new String[] { dd1, hh1, mm1, ss1 };
    }

    private String checkTime(int i) {
        String tmp = "";
        if (i < 10) {
            tmp = "0" + (i < 0 ? 0 : i);
        } else {
            tmp = i + "";
        }
        return tmp;
    }

}
